package light.head.controller.sys;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import light.head.constant.Url;
import light.head.framework.base.SupporterController;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/**
 * 消息模版
 * @author yy
 *
 */
@Controller
@RequestMapping(value = Url.C_MESSAGETEMPLATE)
public class MessageTemplateController extends SupporterController{
	
	//private MessageTemplateDAO mtDAO;
	
	@RequestMapping(value = Url.INIT)
	public ModelAndView init(HttpServletRequest request, HttpServletResponse response) throws Exception {
		return new ModelAndView(Url.MESSAGETEMPLATE_INIT);
	}
	
	/*@RequestMapping(value = Url.QUERY)
	public ModelAndView query(HttpServletRequest request, HttpServletResponse response) throws Exception {
		PageBean pb = createPageBean(request);
		Map<String, String> map = createQueryMapByParmName(request, Parm.NAME);
		if (mtDAO.findByMap(map, pb) == RESULT.SUCCESS){
			request.setAttribute(Parm.PAGE_BEAN, pb);
		}
		return new ModelAndView(Url.MESSAGETEMPLATE_LIST);
	}
	
	@RequestMapping(value = Url.EDIT)
	public ModelAndView edit(Integer code, HttpServletRequest request, HttpServletResponse response) throws Exception {
		if (null != code) {
			MessageTemplate mt = mtDAO.getMt(code);
			System.out.println(mt.getName());
			request.setAttribute(Parm.MT, mt);
		}
		return new ModelAndView(Url.MESSAGETEMPLATE_EDIT);
	}
	
	@RequestMapping(value = Url.SAVE)
	public void save(MessageTemplate tm, HttpServletRequest request, HttpServletResponse response) throws Exception {
		if (null == tm) {
			print(response, Msg.PARAMETER_ERROR);
			return;
		}
		
		if (RESULT.SUCCESS == mtDAO.sou(tm)) {
			mtDAO.loadAll();
			print(response, Msg.SUCCESS);
		}
	}*/
	
//	@Autowired
//	public void setMtDAO(MessageTemplateDAO mtDAO) {
//		this.mtDAO = mtDAO;
//	}

}
